<?php
namespace Admin\Controller;
use Think\Controller;
class ClassStudentController extends CommonController {

	protected $table = 'ClassStudent';

	/**
	 * 初始化
	 */
	public function __construct() {
		parent::__construct();
	}

	/**
	 * 列表
	 */
    public function index(){
		$id = I('get.id','','intval');
		$this->assign('id',$id);
		$where = 'data_student on data_class_student.scid = '.$id.' and data_class_student.ssid = data_student.id';
		$this->pagejoin($this->table, $where, $order, 20); // 分页

		$subject = D('Subject')->lists(); // 学科
		$this->assign('subject',$subject);

		$class = D('Class')->lists(); // 班级
		$this->assign('class',$class);

		$this->display();
    }

	/**
	 * 删除
	 */
	public function del() {
		$id = I('get.id','','intval');
		$msg = D($this->table)->delete($id);
		if(empty($msg)) {
			$this->error('删除失败！');
		} else {
			$this->success('删除成功！',U($this->table.'/index'));
		}
	}

}
